<?php
/*
** date : 2011-2-22 ; copyright : SUEE.CN <http://www.suee.cn> ; author : xjay <xucj21@21cn.com>
*/
class OptionModel extends Model {
	public function getWebOptions(){
		$opts = S('web_options');
		if(empty($opts)){
			$opts = $this->_getData('Weboptions');
			S('web_options',$opts);
		}
		return $opts;
	}
	public function getUserSetting($uid){
		return $this->_getData('Usersetting',array('uid'=>$uid));
	}
	private function _getData($tab,$where = null){
		$arr = $this->table($this->tablePrefix.$tab)->where($where)->select();
		$data = array();
		if($arr){
			foreach($arr as $vo){
				$data[$vo['key']] = $vo['val'];
			}
		}
		return $data;
	}
}